<?php
/**
 * @uses       Custom_Rest_Controller
 * @license    trafficgeyser.com
 */

class Custom_Rest_Controller extends Zend_Rest_Controller
{

	/**
	 * Hold api model object
	 * @var $_api
	 */
	protected $_api		= null;

	/**
	 * Hold api access method
	 * @var $_method
	 */
	protected $_method	= null;


    public function init()
    {
        /* Initialize action controller here */
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);

		$this->_api		= new Api_Model_Api();
		$this->_method	= $this->getRequest()->getControllerName().DS.$this->getRequest()->getActionName();
    }

	public function postDispatch()
	{
		$auth = Zend_Auth::getInstance();
		$auth->clearIdentity();
	}


	public function invalidAction()
	{
		$params = $this->_request->getParams();
		$body = $this->_api->getApiResponse($params['controller'].DS.$params['action'], false, $this->_request->getRawBody(), Api_Model_Api::ERR_INVALID_DATA_FORMAT);
		$this->getResponse()
				->setHttpResponseCode(403)
				->appendBody($body)
				;
		$this->_request->setModuleName('default')
					->setControllerName('error')
					->setActionName('access')
					->setDispatched(true);
	}


	public function indexAction(){}
    public function getAction(){}
    public function postAction(){}
    public function putAction(){}
    public function deleteAction(){}

}

